/**
 * ImageEntity.java Create on 2012-8-4     
*      
* Copyright (c) 2012-8-4 by yiming     
*      
* @author <a href="alenzhangym@hotmail.com">Yiming</a>     
* @version 1.0 
 */
package com.yimi.service;

import android.os.Parcel;

/**
 * TODO 功能描述    
 *      
 *  
 *      
 * @author Yiming
 * @version 1.0 
 */
public class ImageEntity extends Entity {
    private byte[] image;
    private String fileURL;
    private int  currentSize;
    private int  imageSize;
    
    public ImageEntity(){
        super();
    }
    ImageEntity(Parcel in){
        this.readFromParcel(in);
    }
    
    public void readFromParcel(Parcel in){
        super.readFromParcel(in);
        this.readToParcel(in);
    }
    
    public void readToParcel(Parcel in){
        this.fileURL= in.readString();
        imageSize  = in.readInt();
        this.currentSize = in.readInt();
        image = new byte[currentSize];
        in.readByteArray(image);
    } 
    
    public void writePacel(Parcel dest, int flags){
        dest.writeString(fileURL);
        dest.writeInt(imageSize);
        dest.writeInt(currentSize);
        dest.writeByteArray(image);
    }
    
    public byte[] getImage() {
        return image;
    }
    
    public void setImage(byte[] imageSrc) {
        currentSize = imageSrc.length;
        image = new byte[imageSrc.length];
        System.arraycopy(imageSrc, 0, image, 0, imageSrc.length);
    }
    
    public String getFileURL() {
        return fileURL;
    }
    public void setFileURL(String fileURL) {
        this.fileURL = fileURL;
    }
    /**
     * @return the fulllenth
     */
    public int getImageSize() {
        return imageSize;
    }
    /**
     * @param fulllenth the fulllenth to set
     */
    public void setImageSize(int fulllenth) {
        this.imageSize = fulllenth;
    }
    
    public int getCurrentSize() {
        return currentSize;
    }
    public void setCurrentSize(int currentSize) {
        this.currentSize = currentSize;
    }
}
